/**
 * Created by yyk on 4/26/17.
 */


var baseUrl = "http://www.315jmw.com";

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null)return decodeURI(r[2]);
    return null;
}

function RenderProjectItem(project) {
    var str = "<li> <a href='project.html?ID=" + project.id + "'> \
				<img src=" + project.thumb + "> \
				<strong>" + project.name + "</strong> \
				<p class='txt'>" + project.label + "</p> \
				<p class='main'>投资：<span>" + project.amount + "</span>  总部:<span>" + project.city + "</span></p>"


    var major = project.major;
    var arr = major.split(" ");
    var stra = "";
    for (var i = 0; i < arr.length; i++) {
        if (arr[i] === "") continue;
        // if(arr[i] != "" && arr[i] != " ") {
        stra += "<span>" + arr[i] + "</span>"
        // }
        // console.log(arr[i].empty());
    }
    var labelHtml = "<div class='label' >" + stra + "</div></a></li>";
    return str + labelHtml;

}

//写cookies
function setCookie(name, value) {
    var exp = new Date();
    exp.setTime(exp.getTime() + 2 * 60 * 60 * 1000);
    document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
}

//读取cookies
function getCookie(name) {
    var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
    if (arr = document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}
